﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects;
using MonoDevelop.Projects.Dom.Parser;
using MonoDevelop.Projects.CodeGeneration;
using MonoDevelop.Ide.Gui;

namespace Coq.MonoDevelop
{
    public class CoqLanguageBinding : ILanguageBinding
    {
        static string LanguageName = "Coq";

        private Document doc;

        #region Properties

        //ILanguageBinding
        public string Language { get { return LanguageName; } }

        public string SingleLineCommentTag { get { return "//"; } }

        public string BlockCommentStartTag { get { return "(*"; } }

        public string BlockCommentEndTag { get { return "*)"; } }

        public IParser Parser { get { return new CoqParser(); } }

        public IRefactorer Refactorer { get { return null; } }


        #endregion

        #region Methods

        public CoqLanguageBinding()
        {
            IdeApp.Workbench.ActiveDocumentChanged += new EventHandler(Workbench_ActiveDocumentChanged);
        }

        void Workbench_ActiveDocumentChanged(object sender, EventArgs e)
        {
            doc = IdeApp.Workbench.ActiveDocument;
            //Parser.Parse(null, doc.FileName, doc.TextEditor.Text);
        }

        public bool IsSourceCodeFile(string fileName)
        {
            return fileName.ToLower().EndsWith(".v");
        }

        public string GetFileName(string fileNameWithoutExtension)
        {
            return string.Concat(fileNameWithoutExtension,".v");
        }

        #endregion

        #region IDotNetLanguageBinding implementation
        //public BuildResult Compile(ProjectItemCollection items, DotNetProjectConfiguration configuration, ConfigurationSelector configSelector, IProgressMonitor monitor)
        //{
        //    return null;
        //}

        //public ProjectParameters CreateProjectParameters(System.Xml.XmlElement projectOptions)
        //{
        //    return new ConfigurationParameters();
        //}

        //public ConfigurationParameters CreateCompilationParameters(System.Xml.XmlElement projectOptions)
        //{
        //    return new ConfigurationParameters();
        //}

        //public System.CodeDom.Compiler.CodeDomProvider GetCodeDomProvider()
        //{
        //    return null;
        //}

        //public ClrVersion[] GetSupportedClrVersions()
        //{
        //    return new ClrVersion[] { ClrVersion.Net_4_0, ClrVersion.Net_1_1 };
        //}

        //public string ProjectStockIcon
        //{
        //    get
        //    {
        //        return "md-coq-project";
        //    }
        //}
        #endregion
        
    }
}
